package com.example.config;

import com.example.properties.SmsProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class smsconfig {
    @Bean
    public  com.aliyun.dysmsapi20170525.Client createClient(SmsProperties smsProperties) throws Exception {
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                .setAccessKeyId(System.getenv(smsProperties.getKeyId()))
                .setAccessKeySecret(System.getenv(smsProperties.getSecret()));
               config.endpoint = smsProperties.getEndpoint();
        return new com.aliyun.dysmsapi20170525.Client(config);
    }
}
